<template>
  <div style="padding: 14px;">
      <div >
        <div style="text-align: center;font-weight: bolder;font-size: 18px">新闻标题：{{newsList[0].newTitle}}</div>
        <div v-if="newsList[0].newsImage == null">
<!--          <span>封面<image-preview :src="src" class="image"></image-preview></span>-->
          <el-carousel trigger="click" type="card" >
            <el-carousel-item v-for="item in imageList" :key="item">
              <image-preview class="medium":src="item"></image-preview>
            </el-carousel-item>
          </el-carousel>
        </div>
        <div v-if="newsList[0].newsImage != null">
          <div>封面<image-preview :src="newsList[0].newsImage" class="image"/></div>
        </div>
        <div class="bottom clearfix">
          <time class="time">发布时间：{{ newsList[0].createTime }}</time>
        </div>
        <div style="font-weight: bolder;font-size: 18px">新闻内容</div>
        <div class="newContent" v-html="newsList[0].newContent"></div>
      </div>
  </div>
</template>

<script>
import {listNews} from "@/api/system/news";
export default {
  name: "viewNews",
  data() {
    return {
      id: this.$route.query.newId,
      queryParams:{},
      newsList:[],
      imageList:[
        "https://imgtu.com/i/O6xubn",
      ],
      src:'https://imgtu.com/i/O6xubn'
    }
  },
  mounted(){
    this.getList()
  },
  // created() {
  //   this.getList()
  // },
  methods:{
    /** 查询新闻发布管理列表 */
    getList() {
      const self = this
      self.loading = true;
      debugger
      self.queryParams.newId = self.id
      listNews(self.queryParams).then(response => {
        self.newsList = response.rows;
        self.total = response.total;
        self.loading = false;
      });
    },
  },

}
</script>

<style scoped>
.image {
  width: 500px;
  height:260px;
  adding-left: 350px;
  margin: 0 auto;
}
.newContent{

}
.time {
  font-size: 13px;
  padding-left: 810px;
  color: #999;
}
</style>
